<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">  
<title>专利协同服务网络平台</title>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/layer.js"></script>

</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#" onClick="javascript:history.back();">沟通交流</a></li>
			<li><a href="#">回复问题</a></li>
		</ul>
    </div>
    <div class="formbody">
		<div class="formtitle"><span>回复问题</span></div>
		<ul class="forminfo">
			<li><label>回复内容</label><textarea  id="content" name="content" cols="" rows="" class="textinput"></textarea></li>
			<li><label>&nbsp;</label><input type="button" onclick="submitForm()" class="btn" value="提交" style="width:80px;"/>
				<span id="errorMsg" style="color:red; margin-left:90px; margin-top:10px;"></span>
			</li>
		</ul> 
    </div>
    <script type="text/javascript">
    function submitForm(){
		var posterId = "${posterId}";
		var floor = parseInt("${floor}");
		var content = $("#content").val();
		if(content == null || content == ""){
			$("#errorMsg").html("回复内容不能为空!");
		} else {
			$.ajax({
				type:"post",
				data:{"content":content,"posterId":posterId,"floor":floor},
				url:"${pageContext.request.contextPath}/replier/replyQuestion.action",
				dataType:"text",
				success:function(data){
					if(data == "success"){
						layer.msg("问题回复成功");
						setTimeout(function(){
    						var index=parent.layer.getFrameIndex(window.name);
    						parent.window.location.reload();
    						parent.layer.close(index);
						},300);
					} else {
						layer.msg("问题回复失败,请重试");
						setTimeout(function(){
							history.back();
						},100);
					}
				}
			});
		}
	}
    </script>
</body>
</html>